package Communicate;

/**
 * @author wuhan
 * @date 2019/9/21 22:15
 */

class Demo implements Runnable{

    @Override
    public void run() {
        for (int i = 0; i < 70; i++) {
            System.out.println(Thread.currentThread().getName()+"-----"+i);
            Thread.yield();
        }
    }
}


public class JoinDemo {
    public static void main(String[] args) throws InterruptedException {
        Demo demo=new Demo();
        Thread thread0=new Thread(demo);
        Thread thread1=new Thread(demo);
        thread0.start();
        thread1.start();
        for (int i = 0; i < 80; i++) {
            System.out.println("main-----"+i);
        }
        System.out.println("over");
    }
}
